<template>
  <view class="content-home">
    <view class="container">
      <view v-for="(item, index) in list" :key="index" class="item" @click="goInfo(item)">
        <view class="icon">
          <image :src="item.img" style="width: 60rpx;height: 60rpx;"></image>
        </view>
        <view class="u-line-1 title">{{ item.title }}</view>
        <view class="u-line-1 desc">{{ item.desc }}</view>
      </view>
      <view v-if="list.length % 2 !== 0" style="width: 280rpx"></view>
    </view>
  </view>
</template>

<script>
import { mapGetters } from 'vuex'

export default {
  data() {
    return {
    }
  },
  computed: {
    ...mapGetters('userInfo', ['user', 'isGridWorker', 'isCommon', 'isMerchant', 'isLawyer', 'isNightMarketAdministrator']),
    list() {
      return [
        { title: '用印申请', desc: '发起用印申请', url: '/sealApply/post', img: 'https://sanshengcai.com/home/images/house.png', show: true },
        { title: '发布房源', desc: '发布房屋信息', url: '/house/post', img: 'https://sanshengcai.com/home/images/house.png', show: true },
        { title: '房源审核', desc: '审核房源信息', url: `/house/list?review=true`, img: 'https://sanshengcai.com/home/images/house_check.png', show: this.isGridWorker },
        // { title: '发布招聘', desc: '发布招聘信息', url: '/recruitment/post', img: 'https://sanshengcai.com/home/images/recruitment.png', show: true },
        // { title: '招聘审核', desc: '审核招聘信息', url: '/recruitment/list?review=true', img: 'https://sanshengcai.com/home/images/recruitment_check.png', show: this.isGridWorker },
        // { title: '发布求职', desc: '发布求职信息', url: '/work/post', img: 'https://sanshengcai.com/home/images/work.png', show: true },
        // { title: '求职审核', desc: '审核求职信息', url: '/work/list?review=true', img: 'https://sanshengcai.com/home/images/work_check.png', show: this.isGridWorker },
        { title: '发布美食', desc: '发布美食信息', url: '/food/post', img: 'https://sanshengcai.com/home/images/food.png', show: this.isNightMarketAdministrator },
        // { title: '美食审核', desc: '审核美食信息', url: '/food/list?review=true', img: 'https://sanshengcai.com/home/images/food_check.png', show: this.isGridWorker },
        { title: '发布资讯', desc: '发布资讯信息', url: '/information/post', img: 'https://sanshengcai.com/home/images/information.png', show: this.isGridWorker },
        // { title: '资讯审核', desc: '审核资讯信息', url: '/information/list?review=true', img: 'https://sanshengcai.com/home/images/information_check.png', show: this.isGridWorker },
        { title: '发布法律资讯', desc: '发布法律资讯', url: '/lawyer/post', img: 'https://sanshengcai.com/home/images/lawyer.png', show: this.isLawyer },
        // { title: '法律资讯审核', desc: '审核法律资讯', url: '/lawyer/list?review=true', img: 'https://sanshengcai.com/home/images/lawyer_check.png', show: this.isGridWorker },
        { title: '法律援助', desc: '法律援助信息', url: '/lawyer/rescue', img: 'https://sanshengcai.com/home/images/lawyer.png', show: this.isCommon },
      ].filter(i => i.show)
    }
  },
  methods: {
    goInfo(item) {
      uni.navigateTo({
        url: item.url
      });
    },
  }
}
</script>

<style scoped lang="scss">
.content-home {
  .container {
    display: flex;
    justify-content: space-evenly;
    flex-wrap: wrap;
    padding-top: 40rpx;
  }

  .item {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 40rpx;
    width: 280rpx;
    height: 280rpx;
    background-color: #fff;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    border-radius: 16rpx;
    justify-content: center;
    align-items: center;
  }

  .icon {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 20rpx;
  }

  .title {
    margin-bottom: 10rpx;
  }

  .desc {
    color: #666;
    font-size: 20rpx;
  }
}
</style>
